﻿using System;
using BusinessObject;
using System.Web.UI.WebControls;

namespace ViewLayer.Account
{
    public partial class Register : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //RegisterUser.ContinueDestinationPageUrl = Request.QueryString["ReturnUrl"];            
            //Perfil.DataSource = PerfilBO.Instance.GetAll();
            //Perfil.DataValueField = "ID";
            //Perfil.DataTextField = "Nome";
            //Perfil.DataBind();
        }

        //protected void RegisterUser_CreatedUser(object sender, EventArgs e)
        //{
        //    FormsAuthentication.SetAuthCookie(RegisterUser.UserName, false /* createPersistentCookie */);

        //    string continueUrl = RegisterUser.ContinueDestinationPageUrl;
        //    if (String.IsNullOrEmpty(continueUrl))
        //    {
        //        continueUrl = "~/";
        //    }
        //    Response.Redirect(continueUrl);
        //}

        protected void CreateUserButton_Click(object sender, EventArgs e)
        {
            if (UserBO.Instance.InsertUser(this.UserName.Text, this.Password.Text, this.Email.Text, this.Name.Text, "Administrador"))
            {
                Response.Redirect("../Account/Login.aspx");
            }
        }

        protected void GoBackButton_Click(object sender, EventArgs e)
        {
            Response.Redirect("../Account/Login.aspx");
        }
    }
}